package com.uuticketweb.ticket.db;

public class HqlUtils {
	public static String getWildcardString(String strValue) {
        return "%" + strValue + "%";
    }

    /*public static void appendWhereAnd(StringBuffer condition) {
        if(condition.length() == 0) {
            condition.append(" where ");
        } else {
            condition.append(" and ");
        }
    }*/

    public static void appendAnd(StringBuffer condition) {
        if(condition.length() != 0) {
            condition.append(" and ");
        }
    }

    public static void appendComma(StringBuffer orderby) {
        if(orderby.length() != 0) {
            orderby.append(" , ");
        }
    }
    
    public static void appendOr(StringBuffer condition) {
        if(condition.length() != 0) {
        	condition.append(" or ");
        }
    }

    public static void insertOrderBy(StringBuffer orderby) {
        if(orderby.length() != 0) {
            orderby.insert(0, " order by ");
        }
    }
    public static void insertWhere(StringBuffer condition) {
        if(condition.length() != 0) {
            condition.insert(0, " where ");
        }
    }
    public static void insertAnd(StringBuffer condition) {
        if(condition.length() != 0) {
            condition.insert(0, " and ");
        }
    }
}
